﻿using System.Collections.Generic;
using System.Threading.Tasks;
using JX.Core;
using JX.Core.Entity;

namespace JX.Application
{
	/// <summary>
	/// 数据库表：FlowProcess 的应用层服务接口.
	/// </summary>
	public partial interface IFlowProcessServiceAppDapper : IServiceAppDapper<FlowProcessEntity>
	{
        #region 添加
        /// <summary>
        /// 为指定角色集添加任务进程
        /// </summary>
        /// <param name="flowProcessInfo"></param>
        /// <param name="statusCodes"></param>
        /// <param name="roleIds"></param>
        /// <returns></returns>
        bool Add(FlowProcessEntity flowProcessInfo, string statusCodes, string roleIds);
        /// <summary>
        /// 添加角色到工作流进程
        /// </summary>
        /// <param name="flowId"></param>
        /// <param name="processId"></param>
        /// <param name="groupIds">多个ID用“,”分隔</param>
        /// <returns></returns>
        bool AddGroupToProcessGroup(int flowId, int processId, string groupIds);
        /// <summary>
        /// 添加工作流程状态码 ProcessStatusCode
        /// </summary>
        /// <param name="flowId"></param>
        /// <param name="processId"></param>
        /// <param name="stateCodesId"></param>
        /// <returns></returns>
        bool AddStatusCodeToProcessStatusCode(int flowId, int processId, string stateCodesId);
		#endregion

		#region 删除
		/// <summary>
		/// 删除工作流任务进程及相关信息
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <returns></returns>
		bool Delete(int flowId);
		/// <summary>
		/// 删除工作流任务进程
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <param name="processId">步骤ID</param>
		/// <returns></returns>
		bool Delete(int flowId, int processId);
		/// <summary>
		/// 删除指定工作流的所有审核角色
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <returns></returns>
		bool DeleteWorkFlowInProcessRole(int flowId);
		/// <summary>
		/// 删除指定工作流的、指定步骤的所有审核角色
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <param name="processId">步骤ID</param>
		/// <returns></returns>
		bool DeleteGroupInProcess(int flowId, int processId);

		/// <summary>
		/// 删除工作流的审核状态码
		/// </summary>
		/// <param name="statusCode"></param>
		/// <returns></returns>
		bool DeleteStatusCodeInProcessStatusCode(int statusCode);
		/// <summary>
		///  删除指定工作流程的、指定步骤的审核状态码
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <param name="processId">步骤ID</param>
		/// <returns></returns>
		bool DeleteStatusCodeInProcessStatusCode(int flowId, int processId);
		/// <summary>
		/// 删除指定工作流的所有审核状态码
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <returns></returns>
		bool DeleteWorkFlowInProcessStatusCode(int flowId);
		#endregion

		#region 修改
		/// <summary>
		/// 批量更新工作流流程信息
		/// </summary>
		/// <param name="flowProcessInfo"></param>
		/// <param name="statusCodes"></param>
		/// <param name="roleIds"></param>
		/// <returns></returns>
		bool Update(FlowProcessEntity flowProcessInfo, string statusCodes, string roleIds);
		/// <summary>
		/// 更新工作流中的角色信息
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processId"></param>
		/// <param name="roleIds"></param>
		/// <returns></returns>
		bool UpdateRoleInProcessRole(int flowId, int processId, string roleIds);
		/// <summary>
		/// 更新工作流审核记录
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processId"></param>
		/// <param name="stateCodesId"></param>
		/// <returns></returns>
		bool UpdateStatusCodeInProcessStatusCode(int flowId, int processId, string stateCodesId);
		#endregion

		#region 存在数据
		/// <summary>
		/// 判断是否存在指定工作流的处理进程
		/// </summary>
		/// <param name="flowId"></param>
		/// <returns></returns>
		bool ExistWorkFlowInFlowProcess(int flowId);
		/// <summary>
		/// 判断指定工作流进程是否存在
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processName"></param>
		/// <returns></returns>
		bool ExistFlowProcess(int flowId, string processName);
		/// <summary>
		/// 判断角色是否包含在工作流流程中
		/// </summary>
		/// <param name="roleId"></param>
		/// <returns></returns>
		bool ExistRoleInProcessRole(int roleId);
		/// <summary>
		/// 判断是否存在指定工作流的审核角色
		/// </summary>
		/// <param name="flowId"></param>
		/// <returns></returns>
		bool ExistWorkFlowInProcessRole(int flowId);
		/// <summary>
		/// 判断工作流流程中是否存在角色
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processId"></param>
		/// <returns></returns>
		bool ExistRoleInProcessRole(int flowId, int processId);
		/// <summary>
		/// 是否存在指定的审核状态码
		/// </summary>
		/// <param name="statusCode"></param>
		/// <returns></returns>
		bool ExistStatusCodeInProcessStatusCode(int statusCode);
		/// <summary>
		/// 判断是否存在指定工作流的审核状态码
		/// </summary>
		/// <param name="flowId"></param>
		/// <returns></returns>
		bool ExistWorkFlowInProcessStatusCode(int flowId);
		/// <summary>
		///  判断指定工作流进程中是否存在审核状态码
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processId"></param>
		/// <returns></returns>
		bool ExistStatusCodeInProcessStatusCode(int flowId, int processId);
		#endregion

		#region 得到实体
		/// <summary>
		/// 获取工作流流程信息
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <param name="processId">步骤ID</param>
		/// <returns></returns>
		FlowProcessEntity GetFlowProcessById(int flowId, int processId);
		/// <summary>
		/// 获取工作流流程信息
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <param name="roleId">角色ID</param>
		/// <returns></returns>
		FlowProcessEntity GetFlowProcessByRoles(int flowId, int roleId);
		/// <summary>
		/// 获取工作流流程信息
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <param name="roleIdArr">角色ID，多个ID用“,”分隔</param>
		/// <returns></returns>
		FlowProcessEntity GetFlowProcessByRoles(int flowId, string roleIdArr);
		#endregion

		#region 得到实体列表
		/// <summary>
		/// 获取工作流流程信息列表
		/// </summary>
		/// <param name="flowId">流程ID</param>
		/// <returns></returns>
		IList<FlowProcessEntity> GetFlowProcessList(int flowId);
		#endregion

		#region 得到审核角色
		/// <summary>
		/// 获取工作流流程中的所有角色ID集
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processId"></param>
		/// <returns></returns>
		string GetGroupIdByProcessIdAndFlowId(int flowId, int processId);
		/// <summary>
		/// 获取工作流流程角色列表
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processId"></param>
		/// <returns></returns>
		IList<RolesEntity> GetProcessRoleList(int flowId, int processId);
		#endregion

		#region 得到审核状态码
		/// <summary>
		/// 获取指定角色列表的工作流审核状态码集
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="rolesId"></param>
		/// <returns></returns>
		string GetStatusCodeToProcessStatusCode(int flowId, string rolesId);
		/// <summary>
		/// 获取指定工作流程进程的状态码
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="processId"></param>
		/// <returns></returns>
		IList<StatusEntity> GetProcessStatusCodeList(int flowId, int processId);
		#endregion
	}
}